package com.base.utils;

import com.github.pagehelper.PageHelper;

import java.util.ArrayList;
import java.util.List;

/**
 * @author gxd
 * @since 2025/6/6
 */
public class PageUtils extends PageHelper {

    /**
     * 手动分页
     * @param total    数据总数
     * @param rowCount 每页行数
     */
    public static List<Integer> manualPage(Long total, int rowCount) {
        int infoCount = total.intValue();
        int pageCount = infoCount / rowCount;

        List<Integer> pageCountList = new ArrayList<>();
        int current = 1;
        for (; current <= pageCount; current++) {
            pageCountList.add(current);
        }

        if (infoCount % rowCount != 0) {
            pageCountList.add(current);
        }

        return pageCountList;
    }
}
